package edu.kjxy.worker0312;

import java.util.Scanner;

public class worker14 {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int max = Integer.MIN_VALUE;
		int min = Integer.MAX_VALUE;
		while(true) {
			int num = in.nextInt();
			if(num == 0) break;
			if(num > max) max = num;
			if(num < min) min = num;
		}
		System.out.println(max + " " + min);
		in.close();
	}

}
